package com.lkx.farmershop.controller;

import com.lkx.farmershop.common.api.ApiResult;
import com.lkx.farmershop.service.JoinReasonInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/join")
public class JoinController {

    @Autowired
    private JoinReasonInfoService joinReasonInfoService;

    /**
     * 拒绝加入组团
     * @param id
     * @return
     */
    @Transactional
    @DeleteMapping("/refuseJoin")
    public ApiResult<String> refuseJoin(@RequestParam("id") Long id) {
        return joinReasonInfoService.refuseJoin(id);
    }

    /**
     * 同意加入组团
     * @param id
     * @return
     */
    @Transactional
    @PostMapping("/agreeJoin")
    public ApiResult<String> agreeJoin(@RequestParam("id") Long id) {
        return joinReasonInfoService.agreeJoin(id);
    }

}
